<!DOCTYPE html>
<html>

<body>

    <h1>Typewriter</h1>

    <button onclick="typeWriter()" style="font-size: 33px;">Click me</button>

    <h1 id="demo"></h1>


    <xmp style="font-size: 22px; font-weight: bolder;  margin-bottom: 66px;  color: black;  font-family: '微软雅黑';">

        必知必会 
        
        var i = 0;
        var txt = 'Lorem ipsum dummy text blabla.';
        var speed = 50;
        function typeWriter() {
            if (i < txt.length) {
                document.getElementById("demo").innerHTML += txt.charAt(i);
                i++;
                setTimeout(typeWriter, speed);
            }
        }
    </xmp>


</body>
<script>
    var i = 0;
    var txt = 'Lorem ipsum dummy text blabla.';
    var speed = 50;
    function typeWriter() {
        if (i < txt.length) {
            document.getElementById("demo").innerHTML += txt.charAt(i);
            i++;
            setTimeout(typeWriter, speed);
        }
    }
</script>
</html>